<?php if (!defined('THINK_PATH')) exit();?><!-- <!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title>权限列表</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="format-detection" content="telephone=no">

  <link rel="stylesheet" href="/Public/layui-demo/layui-v2.5.6/css/layui.css">

</head>

<body style="padding: 10px;">

  <table class="layui-table">
    <colgroup>
      <col width="150">
      <col width="200">
      <col>
    </colgroup>
    <thead>
      <tr>
        <th>权限ID</th>
        <th>权限结构</th>
        <th>名称</th>
        <th>排序</th>
        <th>类型</th>
        <th>操作</th>
      </tr>
    </thead>
    <tbody>
      <?php if(is_array($node)): $i = 0; $__LIST__ = $node;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vol): $mod = ($i % 2 );++$i;?><tr>
          <td><?php echo ($vol["id"]); ?></td>
          <td>
            <p style="text-indent: <?php echo ($vol['level']*20); ?>px;">•&nbsp;<?php echo ($vol["title"]); ?></p>
          </td>
          <td><?php echo ($vol["name"]); ?></td>
          <td><?php echo ($vol["sort"]); ?></td>
          <td>
            <?php if($vol['level'] == 1): ?>项目
              <?php elseif($vol['level'] == 2): ?>
              <div style="color: green">模块</div>
              <?php else: ?>
              <div style="color:blue">操作</div><?php endif; ?>
          </td>
          <td><a href="<?php echo U('Rbac/deleteNode',array('id'=>$vol['id']));?>">删除</a></td>
        </tr><?php endforeach; endif; else: echo "" ;endif; ?>


    </tbody>
  </table>

  <br><br><br>


  <script src="/Public/layui-demo/layui-v2.5.6/layui.js"></script>
  <script>
    layui.use(['form'], function () {
      var form = layui.form
    })
  </script>

</body>

</html> -->


<!-- <html>

<head>
  <meta charset="utf-8">
  <title></title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport"
    content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/Public/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/Public/style/admin.css" media="all">
  <link id="layuicss-layer" rel="stylesheet"
    href="https://www.layui.com/admin/std/dist/layuiadmin/layui/css/modules/layer/default/layer.css?v=3.1.1"
    media="all">
  <style id="LAY_layadmin_theme">
    .layui-side-menu,
    .layadmin-pagetabs .layui-tab-title li:after,
    .layadmin-pagetabs .layui-tab-title li.layui-this:after,
    .layui-layer-admin .layui-layer-title,
    .layadmin-side-shrink .layui-side-menu .layui-nav>.layui-nav-item>.layui-nav-child {
      background-color: #20222A !important;
    }

    .layui-nav-tree .layui-this,
    .layui-nav-tree .layui-this>a,
    .layui-nav-tree .layui-nav-child dd.layui-this,
    .layui-nav-tree .layui-nav-child dd.layui-this a {
      background-color: #009688 !important;
    }

    .layui-layout-admin .layui-logo {
      background-color: #20222A !important;
    }
  </style>
</head>

<body layadmin-themealias="default">
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-col-md12">
        <div class="layui-card">
          <div class="layui-card-header">权限管理</div>
          <div class="layui-card-body">

            <div class="layui-table-box">
              <table class="layui-table">
                <colgroup>
                  <col width="150">
                  <col width="200">
                  <col>
                </colgroup>
                <thead>
                  <tr>
                    <th>权限ID</th>
                    <th>权限结构</th>
                    <th>名称</th>
                    <th>排序</th>
                    <th>类型</th>
                    <th>操作</th>
                  </tr>
                </thead>
                <tbody>
                    <?php if(is_array($node)): $i = 0; $__LIST__ = $node;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vol): $mod = ($i % 2 );++$i;?><tr>
                          <td><?php echo ($vol["id"]); ?></td>
                          <td>
                            <p style="text-indent: <?php echo ($vol['level']*20); ?>px;">•&nbsp;<?php echo ($vol["title"]); ?></p>
                          </td>
                          <td><?php echo ($vol["name"]); ?></td>
                          <td><?php echo ($vol["sort"]); ?></td>
                          <td>
                            <?php if($vol['level'] == 1): ?><span class="layui-badge layui-bg-cyan">项目</span>
                              <?php elseif($vol['level'] == 2): ?>
                              <span class="layui-badge layui-bg-green">模块</span>
                              <?php else: ?>
                              <span class="layui-badge layui-bg-gray">操作</span><?php endif; ?>
                          </td>
                          <td><a class="layui-btn layui-btn-danger layui-btn-xs" href="<?php echo U('Rbac/deleteNode',array('id'=>$vol['id']));?>" lay-event="">删除</a></td>
                        </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                </tbody>
              </table>
            </div>
          </div>

        </div>
      </div>
    </div>
  </div>

  <script src="/Public/layui/layui.js"></script>
  <script>
    layui.use(['index', 'table', 'form'], function () {
      var table = layui.table
    });
  </script>
</body>

</html> -->



<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title></title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport"
    content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/Public/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/Public/style/admin.css" media="all">
  <link id="layuicss-layer" rel="stylesheet"
    href="https://www.layui.com/admin/std/dist/layuiadmin/layui/css/modules/layer/default/layer.css?v=3.1.1"
    media="all">
</head>

<body>

  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-col-md12">
        <div class="layui-card">
          <div class="layui-card-header">用户列表</div>
          <div class="layui-card-body">
            <table class="layui-hide" id="role-table-toolbar" lay-filter="role-table-toolbar"></table>
            <script type="text/html" id="form-table-manager-right">
              <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
            </script>
          </div>
        </div>
      </div>
    </div>
  </div>


  <script src="/Public/layui/layui.js"></script>
  <script>
    layui.config({
      base: '/Public/' //静态资源所在路径
    }).extend({
      index: 'lib/index' //主入口模块
    }).use(['index', 'table', 'form'], function () {
      var $ = layui.$
        , admin = layui.admin
        , table = layui.table
        , form = layui.form
        , util = layui.util;
      table.render({
        elem: '#role-table-toolbar'
        , url: '<?php echo U('Rbac/nodeListApi');?>'
        , toolbar: '#role-table-toolbar-add'
        , title: ''
        , cols: [[
          { type: 'checkbox', fixed: 'left' }
          , { field: 'id', title: '权限ID', sort: true }
          , { field: 'title',  title: '权限结构' }
          , { field: 'name',  title: '名称' }
          , { field: 'sort',  title: '排序' }
          , { field: 'level',  title: '模块',templet: function(d){
        if (d.level==1) {
         return '<span class="layui-badge layui-bg-cyan">项目</span>';
        } else if(d.level==2){
          return ' <span class="layui-badge layui-bg-green">模块</span>';
        } else{
          return '<span class="layui-badge layui-bg-gray">操作</span>';
        }
     } }
          , { field: 'right', title: '编辑', toolbar: '#form-table-manager-right', fixed: 'right' }
        ]]
        , page: false
    });


        //监听行工具事件-删除
      table.on('tool(form-table-manager)', function (obj) {
      if (obj["event"] == "del") {
        layer.confirm('真的删除行么', function (index) {
          var data = { "id": obj.data.id };
          admin.req({
            url: '<?php echo U('Rbac/deleteNode');?>',
            type: 'post',
            data: data,
            done: function (res) {
              if (res.code == 0) {
                layer.msg(res.msg, { icon: 1 });
                obj.del();
                layer.reload(index);
              } else {
                layer.msg(res.msg, { icon: 5 });
              }
            }
          })

      });
      }
    });


  });
  </script>
</body>

</html>